package com.example.mydianping.controller;

import com.example.mydianping.dto.Result;
import com.example.mydianping.service.FollowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/follow")
public class FollowController {

    @Resource
    private FollowService followService;

    //查询共同关注的用户的集合
    @GetMapping("/common/{id}")
    public Result getSameFollow(@PathVariable("id") Long id){
        return followService.getSame(id);
    }

    //查询是否关注
    @GetMapping("/or/not/{id}")
    public Result isFollow(@PathVariable("id") Long id){
        return followService.isFollow(id);
    }
    //关注或者取关
    @PutMapping("/{id}/{idFollow}")
    public Result follow(@PathVariable("id") Long id,@PathVariable("idFollow") Boolean isFollow){
        return followService.follow(id,isFollow);
    }

}
